<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
<%@ include file="/commons/tabs.jsp" %>
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript">
	var windowOption = null;
	var tabOption = null;

	function WindowOption(frameId){
		this.frame = window.frames(frameId);
		/****保存****/
		this.save = function(){
			this.setButtonUnused();
			this.frame.submitForm();
		}
		this.close_window = function(){
			var flag = this.frame.allowClose();
			if(!flag){
				AskConfirmTwo('${key.tipsForCloseWindow}',"projectAddFrameId","saveForBeforeCloseWindow","windowOption.close_window_withoutCondition");
				return;
			}
			this.close_window_withoutCondition();
		}
		this.close_window_withoutCondition = function(){
			var url = "${ctx}/house_projectAction.do?method=removeObjectFSession";
			new Ajax.Request(url,
                   {method: 'post', parameters: null, onComplete:windowClose}
                   );
		}

		/*****设置按钮不可用*****/
		this.setButtonUnused = function (){
			$('btn1_22').disabled = true;
			$('btn1_32').disabled = true;
		}
		/*****设置按钮可用*****/
		this.setButtonUsed = function (){
			$('btn1_22').disabled = false;
			$('btn1_32').disabled = false;
		}
		//设置标识为保存
		this.setIsSave = function (){
			if(this.frame.document.getElementById("isSave"))
				this.frame.document.getElementById("isSave").value = "isSave";
			if(this.frame.document.getElementById("isEdit"))
				this.frame.document.getElementById("isEdit").value = "";
		}
		//设置标识为关闭
		this.setIsEdit = function(){
			if(this.frame.document.getElementById("isSave"))
				this.frame.document.getElementById("isSave").value = "";
			if(this.frame.document.getElementById("isEdit"))
				this.frame.document.getElementById("isEdit").value = "isEdit";
		}
		/******刷新主页面*****/
		this.flushMain = function (){
			findFrame("mainFrame").flushList();
		}
	}

	function TabOption(frameId){
		this.frameObj =  window.frames(frameId);
		this.setTabEnable  = function(){
			ableTabEdit('projectEnvironment'); //配套设施
			ableTabEdit('projectLayout'); //建设规划
			ableTabEdit('projectJoinCorp'); //参建单位
		}
		/*****刷新当前frame******/
		this.flushTab  = function(){
			this.frameObj.document.location.reload();
		}
	}
	/******关闭窗体前，客户选择先保存数据***********/
	function saveForBeforeCloseWindow(){
		windowOption.save();
		windowOption.flushMain();
		windowClose();
	}

	function init(){
		windowOption = new WindowOption('projectInfo');
		tabOption = new TabOption('projectInfo');

		<c:if test="${!empty is_Project_Edit}">
			tabOption.setTabEnable();
		</c:if>
	}
</script>
</head>
<body onload="init();">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td>
        	<img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle">
        	<span class="window_head_intext">${empty is_Project_Edit? key.project_add : key.project_edit}</span>
        </td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td valign="middle" class="content">
		<pms:tabPanel panelId="projectBase" hasTop="false" iframeId="projectInfo" defaultHeight="350px" barWidthLeft="70%">
			<pms:tab tabId="baseInformation"
					 baseUrl="${ctx}/house_projectAction.do?method=initProjectBaseInfo&isEdit=${is_Project_Edit}"
					 caption="基本资料"
					 beforeFunction="windowOption.setButtonUsed();"
					 defaultTab="true"
					 >
			</pms:tab>
			<pms:tab tabId="projectEnvironment"
					 baseUrl="${ctx}/house_projectAction.do?method=initProjectEnvironmentList"
					 caption="配套设施"
					 beforeFunction="windowOption.setButtonUnused();"
					 canEdit="false"
					 >
			</pms:tab>
			<pms:tab tabId="projectLayout"
					 baseUrl="${ctx}/house_projectAction.do?method=initProjectLayoutAdd"
					 caption="建设规划"
					 beforeFunction="windowOption.setButtonUsed();"
					 canEdit="false"

					 >
			</pms:tab>
			<pms:tab tabId="projectJoinCorp"
					 baseUrl="${ctx}/house_projectAction.do?method=initProjectJoinCorpMain"
					 caption="参建单位"
					 beforeFunction="windowOption.setButtonUsed();"
					 canEdit="false"
					 >
			</pms:tab>
		</pms:tabPanel>
    </td>
    </tr>
  <tr>
    <td class="window_footer"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0" >
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onblur="btn_change(2)" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onClick="windowOption.setIsSave();windowOption.save();"><img src="${ctx}/images/ico_ok.gif" border="0" align="absmiddle" /> 保 存</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0" >
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onblur="btn_change(3)" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onClick="windowOption.setIsEdit();windowOption.close_window();"><img src="${ctx}/images/ico_cancel.gif" border="0" align="absmiddle" /> 关 闭</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
    </table>
</body>
</html>